package com.group01.community.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.group01.community.entity.SysOperLog;
import com.group01.community.mapper.SysOperLogMapper;
import com.group01.community.service.SysOperLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 * 操作日志记录 服务实现类
 * </p>
 *
 * @author guoyuan
 * @since 2025-05-01
 */
@Service
public class SysOperLogServiceImpl extends ServiceImpl<SysOperLogMapper, SysOperLog> implements SysOperLogService {
    @Autowired
    private SysOperLogMapper sysOperLogMapper;

    @Override
    public IPage<SysOperLog> selectCondition(SysOperLog sysOperLog, Long current, Long size) {
        String[] operTime = null;
        if ("".equals(sysOperLog.getOperTime()) || sysOperLog.getOperTime() == null) {
            operTime = new String[]{"", ""};
        } else {
            operTime = sysOperLog.getOperTime().split(",");
        }
        return sysOperLogMapper.selectCondition(sysOperLog, operTime[0], operTime[1], new Page<>(current, size));
    }
}
